//
// See the file COPYING for redistribution information.
//

#ifndef __NAIPAX_SERVICESERVER_HPP__
#define __NAIPAX_SERVICESERVER_HPP__

#include <stdint.h>

namespace Naipax {
    /** This class is a simple TCP/IP server. This is only good in a
     * single thread or a single process. It blocks incoming
     * connections.
     */
    class ServiceServer {
    public:
        /// Constructor
        ServiceServer();

        /// Destructor
        ~ServiceServer();

        /** Set up server
         *
         * @param Port
         * @exception Error::CANNOT_SETUP_SERVER
         */
        void Setup(int32_t Port);

        /// Scan the ServiceServer buffer to see if there is anything
        /// need to be done.
        void Process(void *pArg);

        void (*mOnAccept)(int32_t Fd, void *pArg);
        
    private:
        int32_t _mFd;
        bool _mIsSetup;
    };
};

#endif // __NAIPAX_SERVICESERVER_HPP__
